package com.yum.Iterator;

import com.yum.Comsumer.YComsumer;

import java.util.Iterator;
import java.util.Objects;

public interface YIterator<E>{


    boolean hasNext();

    E next();

    default void forEach(YComsumer<? super E> action){

        if(action == null){
            throw new NullPointerException();
        }
        while (hasNext()){
            action.accept(next());
        }

    }

}
